//
//  ICMAppointmentMaintenanceAndPartsView.h
//  ICrEAM
//
//  Created by Cty on 2016/11/03.
//  Copyright © 2016年 mac. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "ICMTitleTextFeildView.h"
@class ICMPartsTopModel,ICMRepairMaintenancesModel,ICMRepairPartsArrayModel;

@protocol ICMAppointmentMaintenanceAndPartsViewDelegate <NSObject>
@optional
- (void)showRepairEventAndSearchViewWithRepairType:(NSString *)repairType;

@end


@interface ICMAppointmentMaintenanceAndPartsView : UIView<UIAlertViewDelegate>

@property (nonatomic, strong) ICMTitleTextFeildView *workingUnitPriceView;        //工时单价
@property (nonatomic, strong) ICMTitleTextFeildView *workingPriceView;            //工时费
@property (nonatomic, strong) ICMTitleTextFeildView *partsPriceView;              //零件费
@property (nonatomic, strong) ICMTitleTextFeildView *totalPriceView;              //总金额


@property (nonatomic, strong) ICMTitleTextFeildView *workingRatioView;            //工时折扣率
@property (nonatomic, strong) ICMTitleTextFeildView *partsRatioView;              //零件折扣率
@property (nonatomic, strong) ICMTitleTextFeildView *discountedPrice;             //折后总金额

@property (nonatomic, strong) ICMTitleTextFeildView *finishTimeView;

@property (nonatomic, weak) id<ICMAppointmentMaintenanceAndPartsViewDelegate> delegate;

@property (nonatomic, strong) NSMutableArray *repairEventArray;

@property (nonatomic, strong) NSMutableArray *repairPartsArray;

@property (nonatomic, strong) NSMutableArray *repairTypes;

@property (nonatomic, assign) BOOL isPayForType;

@property (nonatomic, strong) NSString *modelCode;//查询时要传车型
@property (nonatomic, strong) ICMTitleTextFeildView *carTypeView;


@property (nonatomic, strong) NSString *SERIES_LABOUR_PRICE;//车系单价

//用于保存删除的项目零件model
@property (nonatomic, strong) NSMutableArray *delRepairPartsArray;
@property (nonatomic, strong) NSMutableArray *delRepairEventArray;

//选中需要删除的零件或项目index
@property (nonatomic, assign) NSInteger wishDeleteIndex;

//保存成功后需要将所有的零件和项目状态初始化
- (void)setAllStateToInit;

- (void)resetRepairTypeButton;

+ (instancetype)createICMMaintenanceAndPartsViewWithFrame:(CGRect)frame;

//编辑模式调用
- (void)setupPartsViewWithPartsTopModel:(ICMPartsTopModel*)topModel;
- (void)setupPartsViewWithRepairMaintenancesModel:(ICMRepairMaintenancesModel*)repairMaintenancesModel;
- (void)setupPartsViewWithRepairPartsArrayModel:(ICMRepairPartsArrayModel*)repairPartsArrayModel;
- (void)refreshInEditType;

@end
